﻿@model CloudFranceTriple.Models.NewsSet

@{
    ViewBag.Title = CloudFranceTriple.WebRole.Properties.Resources.NewsEditTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="content-padding">
    <h1>@CloudFranceTriple.WebRole.Properties.Resources.NewsEditTitle</h1>
    <section>
        @using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>NewsSet</legend>

                @Html.HiddenFor(model => model.Id)

                <div class="editor-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsTitle
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Title)
                    @Html.ValidationMessageFor(model => model.Title)
                </div>

                <div class="editor-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsText
                </div>
                <div class="editor-field">
                    <textarea id="Text" name="Text">
                        @Html.DisplayTextFor(model => model.Text)
                    </textarea>
                    @Html.ValidationMessageFor(model => model.Text)
                </div>

                <div class="display-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsAuthor
                </div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.Author)
                </div>

                <div class="editor-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsDateBegin
                </div>
                <div class="editor-field">
                    @Html.TextBox("DateBegin", CloudFranceTriple.Models.Rules.ConvertTimeZoneFromUtcToUser(new CloudFranceTriple.WebRole.WebSecurityWrapper().CurrentUserId, Model.DateBegin).ToShortDateString())
                    @Html.ValidationMessageFor(model => model.DateBegin)
                </div>

                <div class="editor-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsDateEnd
                </div>
                <div class="editor-field">
                    @Html.TextBox("DateEnd", CloudFranceTriple.Models.Rules.ConvertTimeZoneFromUtcToUser(new CloudFranceTriple.WebRole.WebSecurityWrapper().CurrentUserId, Model.DateEnd ?? Model.DateBegin.AddDays(7)).ToShortDateString())
                    @Html.ValidationMessageFor(model => model.DateEnd)
                </div>

                <div class="editor-label">
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsOrder
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Order)
                    @Html.ValidationMessageFor(model => model.Order)
                </div>

                <p>
                    <input type="submit" value="@CloudFranceTriple.WebRole.Properties.Resources.ButtonSave" />
                </p>
            </fieldset>
        }
        @Html.Partial("_NewsBackToList")
    </section>
</div>
<script type="text/javascript" src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script type="text/javascript">tinymce.init({
    selector: "textarea#Text",
    theme: "modern",
    plugins: ["autolink link image charmap print preview emoticons media textcolor searchreplace wordcount code contextmenu paste"],
    toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    toolbar2: "print preview media | forecolor backcolor emoticons",
});</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#DateBegin").datepicker($.datepicker.regional["fr"]);
        $("#DateEnd").datepicker($.datepicker.regional["fr"]);
    });
    jQuery(function ($) {
        $.datepicker.regional['fr'] = {
            closeText: 'Ok',
            prevText: '&#x3c;Préc',
            nextText: 'Suiv&#x3e;',
            currentText: 'Aujourd\'hui',
            monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
            'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
            monthNamesShort: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun',
            'Jul', 'Aoû', 'Sep', 'Oct', 'Nov', 'Déc'],
            dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
            dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
            dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
            weekHeader: 'S',
            dateFormat: 'dd/mm/yy',
            firstDay: 1,
            isRTL: false,
            showMonthAfterYear: false,
            yearSuffix: '',
            showAnim: 'drop',
            showOtherMonths: true,
            selectOtherMonths: true,
            showButtonPanel: false,
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 1,
            showWeek: false,
            setDate: '1/1/1995',
            minDate: '-90Y',
            maxdate: '-18Y',
        };
        $.datepicker.setDefaults($.datepicker.regional['fr']);
    });
</script>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
